package com.kehao.leetcode.middle.other;

import org.junit.Test;

//不适用+-的方式实现 加法
public class TwoSumSolution {

    public int getSum(int a, int b) {
        if(a==0||b==0) return a|b;
        int sum = a^b;
        int carry = a&b;
        return getSum(sum,carry<<1);
    }

    @Test
    public void test01(){
        System.out.println(getSum(2,3));
    }
}
